#!/usr/bin/python

import sys
from unidata import *

d = dict()

for line in sys.stdin:
	if unidata_comment(line):
		continue

	tokens = line.split(';')
	codepoint = unidata_strip(tokens[0])
	condition = unidata_strip(tokens[4])
	tolower, toupper = unidata_strip(tokens[1]), unidata_strip(tokens[3])

	if condition or not tolower or tolower == codepoint:  # only unconditional
		continue

	d[unidata_strip(codepoint)] = unidata_split(tolower)

for codepoint, replacement in sorted(d.iteritems()):
	print '%06X %s' % (int(codepoint, base=16), ','.join(replacement))
